This function implements the Pseudo-Expectation Gauss-Seidel (PEGS) algorithm for multi-trait genomic prediction models. It supports fitting one or more random effects and can apply factor-analytic approximations to the genetic covariance structure.
pegs(Y, X, maxit = 100, logtol = -4, NNC = FALSE,
covbend = 1.1, covMinEv = 10e-4, XFA = -1)A list containing the following components:
Vector of intercepts for each response variable.
A matrix of regression coefficients (p x k) if a single X matrix is provided,
or a named list of such matrices if a list is provided for X.
Matrix of predicted values (n x k).
Vector of heritability estimates for each trait.
The genetic correlation matrix (k x k) if a single X matrix is provided,
or a named list of such matrices for each random effect.
The inflation factor added to the diagonal of the genetic variance matrix. This will be a single value if one random effect is fit, or a named vector if multiple effects are fit.
The number of iterations until convergence.
The final convergence value.
A numeric matrix (n x k) of dependent variables, where n is the number of observations and k is the number of response variables. Missing values should be NA.
A numeric matrix (n x p) of predictors (i.e., markers) for a single random effect, or a named list of such matrices for multiple random effects.
An integer specifying the maximum number of iterations.
A numeric value for the convergence tolerance on a log10 scale. The algorithm stops when the log10 of the sum of squared changes in coefficients is less than this value.
A logical value. If TRUE, imposes a constraint of non-negative correlations on the genetic covariance matrix.
A numeric bending factor used to inflate the diagonal of the covariance
matrix if it is not positive semi-definite. The bending amount is calculated as
abs(min_eigenvalue) * covbend.
The minimum allowable eigenvalue for the genetic covariance matrix. If the smallest eigenvalue falls below this threshold, the matrix is "bent" (diagonally inflated) to make it positive semi-definite.
An integer specifying the number of factors (principal components) to use in the factor-analytic approximation of the genetic covariance matrix.
XFA = -1 (Default): Fits a full-rank model (no approximation).
XFA = 0: Fits a diagonal model, assuming independent genetic effects among traits.
XFA > 0: Fits a reduced-rank model using the specified number of factors.
Xavier, A., Runcie, D., & Habier, D. (2025). Megavariate methods capture complex genotype-by-environment interactions. Genetics, 229(4), iyae179.
Xavier, A., & Habier, D. (2022). A new approach fits multivariate genomic prediction models efficiently. Genetics Selection Evolution, 54(1), 45.
# Load simulated data with one random effect
data(test)
# Fit a standard multi-trait model
fit <- pegs(Y, X)
# Heritability
print(fit$h2)
# Genetic correlations
print(fit$GC)
# Accuracy
print(mean(diag(cor(fit$hat, simu$tbv))))
Run the code above in your browser using DataLab